// 变量的解构
// ...扩展运算符 ...Rest element 必须是最后一项

let x = 9
let y = 23;
[y, x] = [x, y];
// let m = x
// x = y
// y = m
console.log(x) // 23
console.log(y) // 9


const p = {
  firstName: "john",
  lastName: "三",
  // a: "this.firstName + this.lastName"
  // a: undefined
  a: null
}

const { a: aaa = "aaa默认值", ...other } = p
console.log(aaa)
console.log(other)

// const { lastName: l, firstName: f, a = "我是a的默认值" } = p
// console.log(a)


// console.log(l, f)
// const { key: 别名} = p
// console.log(lastName)
// console.log(firstName)
// console.log(a)


// const arr = ["hello", [1, 2], 4, {}]
// const arr = ["hello", null]
// const [a, b = "我是默认的b"] = arr
// console.log(a)
// console.log(b)

// const [a, ...c] = arr
// const [...c] = arr
// console.log(a)
// console.log(c)

// const [a, b, c] = arr
// const [a, , c] = arr
// const [a, b, c, x] = arr
// console.log(x)


// let [a, b, c] = [1, 2, 3]
// console.log(a)
// console.log(b)
// console.log(c)










// function f() {}
// var
// var f = function () {}

// var, function
// let, const, class, import


